package org.example.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller

@RequestMapping("/test")
public class TestController {
    @RequestMapping("/1")
    public String t1(){
        return "redirect:/home.html";//重定向
    }

    @RequestMapping("/2")
    @ResponseBody
    public String t2(){
        return "好了，已经知道了";
    }

    @RequestMapping("/3")
    @ResponseBody
    public Object t3(){
        Map<Integer,Object> map=new HashMap<>();
        map.put(1,"张三");
        map.put(2,false);
        map.put(3,"王五");
        return map;
    }

    @RequestMapping("/4")
    public Object t4(){
        Map<Integer,Object> map=new HashMap<>();
        map.put(1,"张三");
        map.put(2,false);
        map.put(3,"王五");
        return ResponseEntity.status(200).body(map);
    }


}
